package com.padakeji.android.pworks.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;

/**
 * Created by AtanL on 2015/9/24.
 */
public class ViewPager extends android.support.v4.view.ViewPager {

    private boolean scrollable = true;

    public ViewPager(Context context) {
        super(context);
    }

    public ViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
    }


    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (this.scrollable) {
            return super.onTouchEvent(event);
        }
        return false;
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent event) {
        if (this.scrollable) {
            return super.onInterceptTouchEvent(event);
        }
        return false;
    }

    public void setScrollable(boolean isScrollable) {
        this.scrollable = isScrollable;
    }

    public boolean getScrollable() {
        return this.scrollable;
    }
}
